import React, { useEffect, useState } from 'react'
import { getProList } from '@/api/pro'
import { Table } from 'antd'
const Index: React.FC = () => {

    const [pro, setPro] = useState([])

    useEffect(() => {
        getProList().then(res => {
            // console.log(res.data.data);
            setPro(res.data.data)
        })
    }, [])

    const columns = [
        {
            title: '序号',
            render(t: any, r: object, i: number) {
                return <span>{i + 1}</span>
            }
        }, {
            title: '商品名称',
            dataIndex: 'proname'
        }
    ]

    return (
        <div>
            <h2>商品列表</h2>
            <Table rowKey={'proid'} dataSource={pro} columns={columns} />
        </div>
    )
}

export default Index